package wan.moneybook.bean;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

public class Row {
	private int seq;
	private String id;
	private int tab;
	private Date date;
	private String description;
	private long cash;
	private long card;
	private int cardtype;
	private int category;

	public Row() {}
	public Row(HttpServletRequest request) {
		setRequest(request);
	}

	private void setRequest(HttpServletRequest request) {
		setSeq(Integer.parseInt(request.getParameter("seq")));
		setId(((Account)request.getSession().getAttribute("account")).getId());
		setTab(Integer.parseInt(request.getParameter("tab")));
		setDate(Long.parseLong(request.getParameter("date")));
		setDescription(request.getParameter("description"));
		setCash(Long.parseLong(request.getParameter("cash")));
		setCard(Long.parseLong(request.getParameter("card")));
		setCardtype(Integer.parseInt(request.getParameter("cardtype")));
		setCategory(Integer.parseInt(request.getParameter("category")));
	}

	public int getSeq() {
		return seq;
	}
	public void setSeq(int seq) {
		this.seq = seq;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public int getTab() {
		return tab;
	}
	public void setTab(int tab) {
		this.tab = tab;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public void setDate(long date) {
		this.date = new Date(date);
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public long getCash() {
		return cash;
	}
	public void setCash(long cash) {
		this.cash = cash;
	}
	public long getCard() {
		return card;
	}
	public void setCard(long card) {
		this.card = card;
	}
	public int getCardtype() {
		return cardtype;
	}
	public void setCardtype(int cardtype) {
		this.cardtype = cardtype;
	}
	public int getCategory() {
		return category;
	}
	public void setCategory(int category) {
		this.category = category;
	}

}
